package org.raymond.iworks.study.basic.designpattern.proxy.cglib;

/**
 * @author raymond
 * @version V1.0
 * @Description: TODO
 */

/**
 * 报错:Unable to make protected final java.lang.Class
 * JDK8 中有关反射相关的功能自从 JDK9 开始就已经被限制了,为了兼容原先的版本,需要在运行项目时添加
 * --add-opens java.base/java.lang=ALL-UNNAMED 选项来开启这种默认不被允许的行为
 */
public class Client {
    public static void main(String[] args) {
        TeacherDao target = new TeacherDao();
        ProxyFactory factory = new ProxyFactory(target);
        TeacherDao proxy = (TeacherDao) factory.getProxyInstance();
        // 执行代理对象的方法,触发intecept方法,从而实现对目标对象的调用
        proxy.teach();
    }
}
